{extend name="Base/common" /}
{block name="content"}
<!-- BEGIN PAGE -->

<style>
    .center{
        display: flex;
        width: fit-content;
        margin: auto;
    }
    .img-item{
        margin: 10px;
        position: relative;
        z-index: 1;
    }
</style>

<div class="page-content" style="padding-top: 10px;">

    <div class="container-fluid">
        <!-- 面包屑开始-->
        <div class="row-fluid">
            <div class="span12">

                <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                <h3 class="page-title">
                    企业账号列表
                </h3>
                <ul class="breadcrumb">
                    <li>
                        <a href="/ops/company/index">列表</a>
                        <i class="icon-angle-right"></i>
                    </li>
                    <li>
                        企业账号详情
                    </li>

                </ul>
                <!-- END PAGE TITLE & BREADCRUMB-->
            </div>
        </div>
        <!-- 面包屑结束 -->

        <!-- 带全选的表格开始 -->
        <div class="row-fluid">

            <div class="span12">

                <!-- BEGIN SAMPLE TABLE PORTLET-->

                <div class="portlet">

                    <div class="portlet-title">

                        <div class="caption"><i class="icon-reorder"></i>详情</div>

                        <!-- 表格内容整体操作结束 -->

                    </div>

                    <div class="portlet-body no-more-tables">

                        <ul class="list-group">
                            <li class="list-group-item">账号： {$data.account}</li>
                            <li class="list-group-item">手机号： {$data.mobile}</li>
                            <li class="list-group-item">电话： {$data.tel}</li>
                            <li class="list-group-item">简介： {$data.brief}</li>
                            <li class="list-group-item">地址： {$data.address}</li>
                            <li class="list-group-item">商家类型： {$type[$data.type]}</li>
                            <li class="list-group-item">公司名称： {$data.name}</li>
                            <li class="list-group-item">轮播图：

                                <div id="img" style="display: flex;margin-left: 100px">
                                    {volist name='data.images' id="vo"}
                                    <div class='img-item'>
                                        <img src='{$vo}' style='width: 120px;'>
                                    </div>
                                    {/volist}
                                </div>

                            </li>
                            <li class="list-group-item">身份证正面： <img src="{$data.face_img}" alt="" style="height: 150px"></li>
                            <li class="list-group-item">身份证背面： <img src="{$data.overleaf_img}" alt=""  style="height: 150px"> </li>
                            <li class="list-group-item">营业执照： <img src="{$data.licence_img}" alt=""  style="height: 150px"> </li>
                            <li class="list-group-item">状态：

                                {switch name="$data.status" }
                                {case value="1"}
                                <span>未审核</span>
                                {/case}
                                {case value="2"}
                                <span>审核中</span>
                                {/case}
                                {case value="3"}
                                <span>审核通过</span>
                                {/case}
                                {case value="4"}
                                <span>审核未通过</span>
                                {/case}
                                {case value="5"}
                                <span>禁用</span>
                                {/case}
                                {/switch}
                            </li>
                        </ul>

                        {switch name="$data.status" }
                        {case value="1"}
                        <div class="center">
                        </div>
                        {/case}
                        {case value="2"}
                        <div class="center">
                            <button class="layui-btn btn-success" onclick="setStatus('{$data.id}', 3)">通过</button>
                            <button class="layui-btn btn-warning" style="margin-left: 20px" onclick="refuse('{$data.id}')">拒绝</button>
                        </div>
                        {/case}
                        {case value="3"}
                        <div class="center">
                            <button class="layui-btn btn-danger"  onclick="setStatus('{$data.id}', 5)">禁用</button>
                        </div>
                        {/case}
                        {case value="4"}
                        <div class="center">
                        </div>
                        {/case}
                        {case value="5"}
                        <div class="center">
                            <button  onclick="setStatus('{$data.id}', 3)" class="layui-btn btn-success">解封</button>
                        </div>
                        {/case}
                        {/switch}
                        <div class="center">
                            <button  onclick="setSlider('{$data.id}')" class="layui-btn btn-success">设置轮播图</button>
                        </div>


                    </div>

                </div>
                <!-- END SAMPLE TABLE PORTLET-->

            </div>
        </div>
        <!-- 带全选的表格结束btn-sort-edit -->

    </div>
</div>

<script>

    function setStatus(id, status) {
        layui.use('layer', function () {
            $.post('/ops/company/setstatus', {status: status, id: id}, function (res) {
                var data = JSON.parse(res);
                if(data.errno == 0){
                    layer.msg('操作成功');
                    location.href = "/ops/company/index"
                }else {
                    layer.msg(data.msg, function (e) {

                    })
                }
            })
        })
    }

    function refuse(id) {
        layui.use("layer",function() {
            layer.prompt({
                formType: 0,
                value: '',
                title: '请拒绝输入原因',
                area: '500px',
                offset: ['200px', '45%']
            }, function (value, index, elem) {
                layer.close(index);

                $.post('/ops/company/setstatus', {id: id, status: 4, reason: value}, function (res) {
                    var data = JSON.parse(res);
                    if(data.errno == 0){
                        layer.msg('操作成功');
                        location.href = "/ops/company/index"
                    }else {
                        layer.msg(data.msg, function (e) {

                        })
                    }
                })


            });
        })
    }

    function setSlider(id) {
        layui.use('layer', function(){
            layer.open({
                type: 2,
                area: ["600px", "400px"],
                content: '/ops/company/slider?id='+id //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
            });

        });
    }

</script>
<!-- END PAGE -->
{/block}